package pair.parking.action;

import pair.parking.bean.Car;
import pair.parking.bean.ParkingLot;
import pair.parking.common.CommonData;

/**
 * Create by Vic Xu on 8/23/2018
 *
 * @author Vic Xu
 */
public class ParkingBoy extends BaseParkingBoy {

    /**
     * 按顺序停车
     *
     * @param car
     * @return
     */
    @Override
    public Car addCar(Car car) {
        for (int i = 0; i < CommonData.PARKING_LOT_MAX_NUM; i++) {
            ParkingLot parkingLot = CommonData.packingLotList.get(i);
            if (parkingLot.isFull() && !isExist(car.getCarNumber())) {
                parkingDetail(i, parkingLot, car);
                return car;
            }
        }
        return null;
    }

    @Override
    public void sort() {

    }

}
